package com.zhangyu.shadow.repair.delegate.search;

import com.alibaba.fastjson.TypeReference;
import com.zhangyu.shadow.repair.config.RepairItemType;
import com.zhangyu.shadow.repair.delegate.search.entity.MaintainEntity;

import java.util.ArrayList;

import st.lib.base.ui.recycler.DataConverter;
import st.lib.base.ui.recycler.MultipleItemEntity;
import st.lib.base.ui.recycler.ObjConverter;

/**
 * @author zhangyu
 * @date 2018/2/13
 */

public class MaintainDataConverter extends DataConverter {

    @Override
    public ArrayList<MultipleItemEntity> convert() {
        MaintainEntity maintainEntity = new ObjConverter<MaintainEntity>().
                convert(getJsonData(), new TypeReference<MaintainEntity>() {
                });
        final MultipleItemEntity multipleItemEntity = MultipleItemEntity
                .builder()
                .setItemType(RepairItemType.ITEM_TYPE_MAINTAIN)
                .setField(RepairItemType.ITEM_MAINTAIN, maintainEntity)
                .build();
        mEntities.add(multipleItemEntity);
        return mEntities;
    }
}
